<?php

declare(strict_types=1);
/**
 * This file is part of habo_new_media.
 *
 * @link     https://www.berlen.cn/
 * @contact  tech@berlen.cn
 * @license  http://gitlab.rehou.cn/habo/habo_new_media/-/blob/master/README.md
 */
namespace app\enum;

/**
 * 数据分析枚举.
 */
class AnalysisEnum
{
    /**
     * @var string 汇总
     */
    public const DATA_STAT = 'stat';

    /**
     * @var string 记录
     */
    public const DATA_REPORT = 'report';

    /**
     * @var string 同步
     */
    public const DATA_SYNC = 'sync';

    /**
     * @var string 追加明细
     */
    public const DATA_APPEND = 'append';

    /**
     * @var string 素材明细
     */
    public const DATA_INFO = 'info';

    /**
     * @var string 账户类型
     */
    public const TYPE_ACCOUNT = 'account';

    /**
     * @var string 视频类型
     */
    public const TYPE_VIDEO = 'video';

    /**
     * @var string 图片类型
     */
    public const TYPE_PIC = 'pic';

    /**
     * @var string 快手
     */
    public const KS_TABLE_PREFIX = 'Ks';

    /**
     * @var string 巨量
     */
    public const OE_TABLE_PREFIX = 'Oe';

    /**
     * @var string 广点通
     */
    public const QQ_TABLE_PREFIX = 'Qq';

    /**
     * @var int 账户类型
     */
    public const TASK_TYPE_ACCOUNT = 1;

    /**
     * @var int 视频类型
     */
    public const TASK_TYPE_VIDEO = 2;

    /**
     * @var int 图片类型
     */
    public const TASK_TYPE_PICTURE = 3;

    /**
     * @var array 任务类型MAP
     */
    public const TASK_TYPE_ARRAY = [
        self::TASK_TYPE_ACCOUNT => self::TYPE_ACCOUNT,
        self::TASK_TYPE_VIDEO => self::TYPE_VIDEO,
        self::TASK_TYPE_PICTURE => self::TYPE_PIC,
    ];

    /**
     * @var int 账户类型
     */
    public const STAT_ACCOUNT = 0;

    /**
     * @var int 客户类型
     */
    public const STAT_CLIENT = 1;

    /**
     * @var int 统计类型-产品
     */
    public const STAT_PRODUCT = 4;

    /**
     * @var int 类型-月份
     */
    public const STAT_MONTH = 5;

    /**
     * @var int 类型-客户媒体月汇总
     */
    public const STAT_CLIENT_MEDIA = 6;

    /**
     * @var int ks用户类型
     */
    public const STAT_KS_USER_VIDEO = 2;

    /**
     * @var int 统计类型-视频
     */
    public const STAT_VIDEO = 3;

    /**
     * @var int 统计类型-KsUserId
     */
    public const STAT_KS_USER_PICTURE = 2;

    /**
     * @var int 统计类型-图片
     */
    public const STAT_PICTURE = 3;

    /**
     * @var array 汇总模型
     */
    public const STAT_MODEL_LIST = [
        CommonEnum::OE_MEDIA => [
            self::TYPE_VIDEO => [
                self::STAT_ACCOUNT => '\app\model\mongo\MongoOeAccountVideoStatModel',
                self::STAT_CLIENT => '\app\model\mongo\MongoOeClientVideoStatModel',
                self::STAT_VIDEO => '\app\model\mongo\MongoOeVideoStatModel',
            ],
            self::TYPE_PIC => [
                self::STAT_ACCOUNT => '\app\model\mongo\MongoOeAccountPicStatModel',
                self::STAT_CLIENT => '\app\model\mongo\MongoOeClientPicStatModel',
                self::STAT_PICTURE => '\app\model\mongo\MongoOePicStatModel',
            ],
            self::TYPE_ACCOUNT => [
                self::STAT_CLIENT => '\app\model\mongo\MongoClientAccountTypeDayStatModel',
                self::STAT_PRODUCT => '\app\model\mongo\MongoProductAccountTypeDayStatModel',
                self::STAT_MONTH => '\app\model\mongo\MongoClientMonthStatModel',
                self::STAT_CLIENT_MEDIA => '\app\model\mongo\MongoClientMediaMonthStatModel',
            ],
        ],
        CommonEnum::KS_MEDIA => [
            self::TYPE_VIDEO => [
                self::STAT_ACCOUNT => '\app\model\mongo\MongoKsAccountVideoStatModel',
                self::STAT_CLIENT => '\app\model\mongo\MongoKsClientVideoStatModel',
                self::STAT_KS_USER_VIDEO => '\app\model\mongo\MongoKsUserVideoStatModel',
                self::STAT_VIDEO => '\app\model\mongo\MongoKsVideoStatModel',
            ],
            self::TYPE_PIC => [
                self::STAT_ACCOUNT => '\app\model\mongo\MongoKsAccountPicStatModel',
                self::STAT_CLIENT => '\app\model\mongo\MongoKsClientPicStatModel',
                self::STAT_KS_USER_PICTURE => '\app\model\mongo\MongoKsUserPicStatModel',
                self::STAT_PICTURE => '\app\model\mongo\MongoKsPicStatModel',
            ],
            self::TYPE_ACCOUNT => [
                self::STAT_CLIENT => '\app\model\mongo\MongoClientAccountTypeDayStatModel',
                self::STAT_PRODUCT => '\app\model\mongo\MongoProductAccountTypeDayStatModel',
                self::STAT_MONTH => '\app\model\mongo\MongoClientMonthStatModel',
                self::STAT_CLIENT_MEDIA => '\app\model\mongo\MongoClientMediaMonthStatModel',
            ],
        ],
        CommonEnum::QQ_MEDIA => [
            self::TYPE_VIDEO => [
                self::STAT_ACCOUNT => '\app\model\mongo\MongoQqAccountVideoStatModel',
                self::STAT_CLIENT => '\app\model\mongo\MongoQqClientVideoStatModel',
                self::STAT_VIDEO => '\app\model\mongo\MongoQqVideoStatModel',
            ],
            self::TYPE_PIC => [
                self::STAT_ACCOUNT => '\app\model\mongo\MongoQqAccountPicStatModel',
                self::STAT_CLIENT => '\app\model\mongo\MongoQqClientPicStatModel',
                self::STAT_PICTURE => '\app\model\mongo\MongoQqPicStatModel',
            ],
            self::TYPE_ACCOUNT => [
                self::STAT_CLIENT => '\app\model\mongo\MongoClientAccountTypeDayStatModel',
                self::STAT_PRODUCT => '\app\model\mongo\MongoProductAccountTypeDayStatModel',
                self::STAT_MONTH => '\app\model\mongo\MongoClientMonthStatModel',
                self::STAT_CLIENT_MEDIA => '\app\model\mongo\MongoClientMediaMonthStatModel',
            ],
        ],
    ];

    /*
     * @var int 待执行状态
     */
    public const TASK_STATUS_WAIT = 0;

    /*
     * @var int 已拉取状态
     */
    public const TASK_STATUS_SUCCESS = 1;

    /*
    * @var int 拉取失败状态
    */
    public const TASK_STATUS_FAIL = 2;

    /**
     * @var array 状态数组
     */
    public const TASK_STATUS_ARR = [
        self::TASK_STATUS_WAIT => '待执行',
        self::TASK_STATUS_SUCCESS => '成功',
        self::TASK_STATUS_FAIL => '失败',
    ];

    /**
     * @var array 任务队列
     */
    public const TASK_QUEUE_LIST = [
        'area_month_stat' => 'analysis:area:month:stat:' . RedisEnum::REDIS_HASH,
        'product_account_type_stat' => 'analysis:product:account:type:stat:' . RedisEnum::REDIS_HASH,
        'video_account_day_stat' => 'analysis:video:account:day:stat:' . RedisEnum::REDIS_HASH,
        'pic_account_day_stat' => 'analysis:pic:account:day:stat:' . RedisEnum::REDIS_HASH,
        'material_day_stat' => [
            self::TASK_TYPE_VIDEO => [
                CommonEnum::OE_MEDIA => 'analysis:material:day:stat:' . self::TYPE_VIDEO . ':oe:' . RedisEnum::REDIS_HASH,
                CommonEnum::KS_MEDIA => 'analysis:material:day:stat:' . self::TYPE_VIDEO . ':ks:' . RedisEnum::REDIS_HASH,
                CommonEnum::QQ_MEDIA => 'analysis:material:day:stat:' . self::TYPE_VIDEO . ':qq:' . RedisEnum::REDIS_HASH,
            ],
            self::TASK_TYPE_PICTURE => [
                CommonEnum::OE_MEDIA => 'analysis:material:day:stat:' . self::TYPE_PIC . ':oe:' . RedisEnum::REDIS_HASH,
                CommonEnum::KS_MEDIA => 'analysis:material:day:stat:' . self::TYPE_PIC . ':ks:' . RedisEnum::REDIS_HASH,
                CommonEnum::QQ_MEDIA => 'analysis:material:day:stat:' . self::TYPE_PIC . ':qq:' . RedisEnum::REDIS_HASH,
            ],
        ],
        'cost_queue_' . self::TYPE_ACCOUNT => 'analysis:cost:' . self::TYPE_ACCOUNT . ':' . RedisEnum::REDIS_HASH,
        'cost_queue_' . self::TYPE_VIDEO => 'analysis:cost:' . self::TYPE_VIDEO . ':' . RedisEnum::REDIS_HASH,
        'cost_queue_' . self::TYPE_PIC => 'analysis:cost:' . self::TYPE_PIC . ':' . RedisEnum::REDIS_HASH,
    ];
}
